﻿include("shared.lua")

surface.CreateFont("Arial", 120, 700, true, false, "Arial120")
surface.CreateFont("Arial", 150, 700, true, false, "Arial150")
surface.CreateFont("Arial", 160, 700, true, false, "Arial160")

//Colors["gm_construct"] = Color(51, 102, 255, 255)

local	Rules = 	{
					{"Admin is always right - Админ всегда прав","Админ всегда прав"},
					{"If Admin is wrong see rule 1","Если Админ не прав смотреть правило 1"},
					{"Don't chat spam","Не спамить в чат"},
					{"Don't prop spam","Не спамить пропами (предметами)"},
					{"Don't be rude to Admin","Не грубить Админу"},
					{"Don't spawn not your buildings","Не спаунить постройки которые сделали не вы"},
					{"And Have Fun! :D","И Веселитесь :D"}
					}
lang = 1	

function UseHook(ply,key)

	if key == IN_USE then return end
	
	local entsphere = ents.FindInSphere(ply:GetPos(),1024) 
	
		for k,v in pairs(entsphere) do
		
			if v:GetClass() == "server_info" then
			
				if lang == 1 then lang = 2 else lang = 1 end
				
			end
			
		end

end
hook.Add("KeyPress","ChangeLanguage",UseHook)

function ENT:Draw()

local players = player.GetAll()
local AllEnts = ents.GetAll()
local TotalEntsCount = table.Count(AllEnts)

	cam.Start3D2D(self:GetPos(), self:GetAngles() + Angle( 0,0,90 ), 0.1)
			
				draw.RoundedBox( 6, 0, 0, 3600, 150, Color( 0, 148, 255, 200 ) )
				
				
				if LocalPlayer():GetPos():Distance(self:GetPos()) < 4096 then
				local welcome_txt_data = {}
					welcome_txt_data.pos = { 1800 + math.sin(CurTime()*2)*80, 60 } 
					welcome_txt_data.color = Color(220, 240, 220, 255)
					welcome_txt_data.text = "Welcome to Funny Build Server!"
					welcome_txt_data.font = "Arial120" 
					welcome_txt_data.xalign = TEXT_ALIGN_CENTER 
					welcome_txt_data.yalign = TEXT_ALIGN_CENTER 
				draw.TextShadow( welcome_txt_data,10,150 )
				end
			

		
		draw.RoundedBox( 6, 0, 170, 3600, 150, Color( 0, 148, 255, 200 ) )
			
		if LocalPlayer():GetPos():Distance(self:GetPos()) < 4096 then	
		local total_ents_txt_data = {}
					total_ents_txt_data.pos = { 1800, 170 + 75 } 
					total_ents_txt_data.color = Color(220, 240, 220, 255)
					total_ents_txt_data.text = "Entites count: " .. tostring(TotalEntsCount)
					total_ents_txt_data.font = "Arial120" 
					total_ents_txt_data.xalign = TEXT_ALIGN_CENTER 
					total_ents_txt_data.yalign = TEXT_ALIGN_CENTER 
		draw.TextShadow( total_ents_txt_data,10,150 )
		end
				
				
				
		
		draw.RoundedBox( 32, 0, 340, 3600, (#Rules * 150), Color( 0, 148, 255, 200 ) )
		
		if LocalPlayer():GetPos():Distance(self:GetPos()) < 4096 then
			for k,v in pairs(Rules) do
				local data = {}
				data.text = tostring(k) .. ". " .. v[lang]
				data.pos = {15, 290 + k * 120}
				data.font = "Arial120"
				data.color = Color(220, 240, 220, 255)
				draw.TextShadow(data,10,150)
			end
		end	
		
	cam.End3D2D()

end